﻿using System;

namespace Rio.Framework.Business
{
    public static class ConvertEx
    {
        /// <summary>
        /// Convert an object to its equivalent DateTime. If null then DateTime.DateMin
        /// </summary>
        /// <param name="p_oSource">string to convert</param>
        /// <returns>DateTime equivalent</returns>
        public static DateTime ToDateTime(this DateTime extention, string p_oSource)
        {
            DateTime l_oDt;
            return DateTime.TryParse(p_oSource, out l_oDt) ? l_oDt : default(DateTime);
        }
    }
}
